import { reactive, ref } from 'vue';
import router from '@/router';

export default function importConfig() {
  const images = [
    'https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/cd7a1aaea8e1c5e3d26fe2591e561798.png~tplv-uwbnlip3yd-webp.webp',
    'https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/6480dbc69be1b5de95010289787d64f1.png~tplv-uwbnlip3yd-webp.webp',
    'https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/0265a04fddbd77a19602a15d9d55d797.png~tplv-uwbnlip3yd-webp.webp',
  ];

  const form = reactive({
    userName: '',
    password: '',
  });

  const formRules = {
    userName: [{ required: true, message: '用户名不能为空' }],
    password: [{ required: true, message: '密码不能为空' }],
  };

  const eyeOpen = ref(true);

  const changeEye = () => {
    eyeOpen.value = !eyeOpen.value;
  };

  const login = () => {
    router.push('/order');
  };

  const register = () => {
    // console.log('注册');
  };

  return {
    images,
    form,
    formRules,
    eyeOpen,
    changeEye,
    login,
    register,
  };
}
